﻿using System.Collections.Generic;
using System.Windows;

namespace PushpinClusterer
{
    public class PushpinContainer<T> where T : IClusteredGeoObject
    {
        private List<T> _pushpins = new List<T>();

        public Point ScreenLocation { get; private set; }

        public PushpinContainer(T pushpin, Point location)
        {
            _pushpins.Add(pushpin);
            ScreenLocation = location;
        }

        public void Merge(PushpinContainer<T> pinContainer)
        {
            foreach (var pin in pinContainer._pushpins)
            {
                _pushpins.Add(pin);
            }
        }

        public ClusteredPushpinItem<T> SelectContainerItem()
        {
            ClusteredPushpinItem<T> model = new ClusteredPushpinItem<T>();
            model.AddRange(_pushpins);

            return model;
        }
    }
}
